/*******************************************************************************
GameDC.h

	Author:		LiuDingXi
	e-mail:		liudx@gmail.com
	Date time:	2009-08-07

	Copyright (C) 2009
	All rights reserved.
	
*******************************************************************************/

#ifndef _GAMEDC_H_
#define _GAMEDC_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "GFont.h"
#include "GText.h"
#include "GImage.h"
#include "Graphics.h"

struct GCLIP
{
	int x;
	int y;
	int cx;
	int cy;
};

struct GOPER
{
	float fAngle;
	float fAlpha;		
};

typedef DWORD COLOR;

#ifndef RGB
#define RGB(r,g,b)   ((COLOR)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
#endif//RGB

class GSight;
class GScene;

class GDC : public Graphics
{
public:
	GDC(HGC hGC);
	virtual ~GDC();

	bool	SceneBind(GScene* pScene);
	bool	SceneUnbind();

	GText*	PrepareText(LPCTSTR lpText, int nText, const GFont* pFont, COLOR cText);
	static BOOL	ReleaseText(GText* pGText);

	void	DrawText(int x, int y, const GText& rGText);
	
public:
	GImage*	CreateImage(LPCTSTR szImageFile);

	void	PushScene(GScene* pScene);
	GScene* PopScene();

	void	Draw(const GImage& rImg, int x, int y, const GCLIP& rClip, const GOPER& rOper);
	void	Draw(const GImage& rImg, int x, int y);

	GScene* GetScene()const;

	GImage*	SceneShot(GScene* pScene);

protected:
	GScene*	m_pScene;
	GScene* m_pTempScene;

};

#endif//_GAMEDC_H_
